﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefBatchInfor" :model="stateBatchInfor.vmModel" label-width="100px">
    <el-row>
      
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" label="产线号">
            <el-input v-model="stateBatchInfor.vmModel.Entity.LineCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" label="工序号">
            <el-input v-model="stateBatchInfor.vmModel.Entity.OperationCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationName_FormItem" prop="Entity.OperationName" label="工序名称">
            <el-input v-model="stateBatchInfor.vmModel.Entity.OperationName" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurrentSN_FormItem" prop="Entity.CurrentSN" label="SN">
            <el-input v-model="stateBatchInfor.vmModel.Entity.CurrentSN" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BatchCode_FormItem" prop="Entity.BatchCode" label="批次号">
            <el-input v-model="stateBatchInfor.vmModel.Entity.BatchCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SingleConsumption_FormItem" prop="Entity.SingleConsumption" label="单次用量">
            <el-input v-model="stateBatchInfor.vmModel.Entity.SingleConsumption" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_orderCode_FormItem" prop="Entity.orderCode" label="所属工单">
            <el-input v-model="stateBatchInfor.vmModel.Entity.orderCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_schduleCode_FormItem" prop="Entity.schduleCode" label="所属排程">
            <el-input v-model="stateBatchInfor.vmModel.Entity.schduleCode" disabled clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_uploadFlag_FormItem" prop="Entity.uploadFlag" label="上传工厂mes" :rules="[{ required: true, message:'上传工厂mes为必填项',trigger:'blur'}]">
            <el-select v-model="stateBatchInfor.vmModel.Entity.uploadFlag" disabled clearable>
                <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
                <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
                </el-select>
        </el-form-item>
    </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onCloseBatchInfor"  type="primary" :button-text="$t('message._system.common.vm.cancel')" style="margin-top:15px;"/>
    </div>
  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message._system.common.vm.detail;false">
import {  ElMessageBox, ElMessage } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { BatchInforApi } from '/@/api/record/BatchInfor';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

// 定义变量内容
const formRefBatchInfor = ref();
const stateBatchInfor = reactive({
      vmModel: {
	  Entity:{
      			ID: null,
			LineCode: null,
			OperationCode: null,
			OperationName: null,
			CurrentSN: null,
			BatchCode: null,
			SingleConsumption: null,
			orderCode: null,
			schduleCode: null,
			uploadFlag: null,

      },
      
	},
    
     
});

// 取消
const onCloseBatchInfor = () => {
    closeDialog();
};


// 页面加载时
onMounted(() => {
    
     if (ci.attrs["wtmdata"]) {
		stateBatchInfor.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateBatchInfor.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	BatchInforApi().get(stateBatchInfor.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateBatchInfor.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

